I know all about integer overflows, but not of floating point overflows. I noticed something odd today. Apparently I can store whatever number I want inside MoHAA's floating point datatype.
It became evident today when I used the new pow function with the arguments 2 & 32. I was under the impression that floats were 32 bits long much like the integers in MorpheusScript but
pow 2 64 was successfully stored in my variable and printed the exact value (except for the first 3 digits, they were 0).
It also works if I directly define a large float:, which should overflow because both integers and floats in MoH are signed.Code:local.var = 4294967296.0 //2 ^32
The greatest value I could largely fit in there was "170141183460469230000000000000000000000.000", after that it kept returning "1.#IO".
The thing is while I can't perform addition or subtraction with these values, I can still correctly divide, multiply and compare them, which makes this 'trick' very interesting to me,
especially since 2^32 is a value that can be quite useful.
Can anyone explain why and/or how this is happening, and if this can cause any kind of stability issues or memory leaks?


Reply With Quote

